<?php

namespace App\Http\Requests\Admin\Customer\Device;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property string account
 * @property string password
 * @property string device_name
 */
class DeviceAccountStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'account'          => 'required|string|unique:device_accounts,account|max:'.self::MAX_STRING,
            'password'         => 'required|string|min:6|max:'.self::MAX_STRING,
            'store_id'         => 'nullable|int|min:1',
            'device_name'      => 'required|string|max:'.self::MAX_STRING,
            'skin_detector_id' => 'nullable|int|min:1',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'account.*'          => '账号已注册，请尝试其他账号',
//            'password.*'         => '密码长度必须6个字符',
//            'store_id.*'         => '店铺id必须是数值',
//            'device_name.*'      => '设备名称必须是字符串',
//            'skin_detector_id.*' => '肤质检测仪类型id必须是数值'
//        ];
//    }
}
